<!-- 消息盒子 -->
<link rel="stylesheet" href="/css/apps/microcase/downlist.css">
<style type="text/css">
.red {
	font-family: PingFangSC-Medium;
	font-size: 12px;
	color: #F23939;
}

.message-ul {
	margin-top: 27px;
}

.message-li {
	padding: 20px 0;
	display: flex;
	background: #F5F5F5;
	margin-bottom: 4px;
	border-radius: 3px;
	opacity: 0.4;
}

.message-li .message-type {
	font-family: PingFangSC-Semibold;
	font-size: 14px;
	color: #363636;
	font-weight: bold;
	flex: 0 0 100px;
	text-align: center;
}

.message-li .message-title {
	font-family: PingFangSC-Medium;
	font-size: 14px;
	color: #515151;
	flex: 0 0 400px;
	text-align: left;
}

.message-li .case-dynamic {
	flex: 0 0 200px;
	font-family: PingFangSC-Medium;
	font-size: 12px;
	color: #6F6F6F;
	text-align: center;
}

.message-li .message-title .view-now {
	font-family: PingFangSC-Medium;
	font-size: 12px;
	color: #F23939;
	margin-left: 20px;
}

.message-li .message-title .message-username {
	font-family: PingFangSC-Medium;
	font-size: 14px;
	color: #53CAE3;
}

.message-li .message-dynamic {
	font-family: PingFangSC-Medium;
	font-size: 12px;
	color: #6F6F6F;
	flex: 0 0 200px;
	text-align: center;
}

.message-li .message-delete {
	font-family: PingFangSC-Medium;
	font-size: 12px;
	color: #999999;
	flex: 0 0 100px;
	text-align: center;
}

.opacity {
	opacity: 1;
}
</style>
<div class="main layui-clear">
<div class="fly-main layui-clear">
	<div class="wrap layui-clear">
		<div class="layui-bar">
			<div class="layui-breadcrumbs">
				<a class="home" href="/"></a>
				<i class="layui-icon">&#xe602;</i>
		  		<a href="/messagebox/index.html">消息盒子</a>
		  		<i class="layui-icon">&#xe602;</i>
		  		<a href="/messagebox/index.html">消息盒子</a>
			</div>
		</div>
		<#include "/apps/user/userTopInformation.html">
		<div class="home-left ukefu-profile-menu">
			<#include "/apps/user/userinfo.html">
		</div>
		<div class="home-right ukefu-profile" id="commenttopic">
			<div class="content">
				<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
					<#include "/apps/messagebox/messageboxmenu.html">
					<div class="layui-tab-content">
						<div class="layui-tab-item layui-show">
							<ul class="message-ul">
								<#if messageList??>
									<#list messageList.content as list>
										<#if list.msgtype==1>
											<li class="message-li <#if list.readunread == '未读'>opacity</#if>" id="${list.id!''}">
												<span class="message-type">帖子</span>
												<a href="#" onclick="gotoLink('/topic/detail/${list.fileid!''}.html?msgid=${list.id!''}','${list.fileid!''}','${list.id}','${list.msgtype!''}')" class="message-title layui-elip">${list.title!''}</a>
												<span class="message-dynamic">帖子有了新的回复</span>
												<a href="#" onclick="deleteLink('${list.id!''}');" class="message-delete">不再提示</a>
											</li>
										<#elseif list.msgtype==8>
											<li class="message-li <#if list.readunread == '未读'>opacity</#if>" id="${list.id!''}">
												<span class="message-type">帖子</span>
												<a href="#" onclick="gotoLink('/topic/detail/${list.fileid!''}.html?msgid=${list.id!''}','${list.fileid!''}','${list.id}','${list.msgtype!''}')" class="message-title layui-elip">${list.title!''}</a>
												<span class="message-dynamic">您的评论有了新的回复</span>
												<a href="#" onclick="deleteLink('${list.id!''}');" class="message-delete">不再提示</a>
											</li>
										<#elseif list.msgtype==9>
											<li class="message-li <#if list.readunread == '未读'>opacity</#if>" id="${list.id!''}">
												<span class="message-type">提现</span>
												<a href="/deposit/depositList.html" class="message-title layui-elip">${list.title!''}</a>
												<span class="message-dynamic"></span>
												<a href="#" onclick="deleteLink('${list.id!''}');" class="message-delete">不再提示</a>
											</li>
										<#elseif list.msgtype==10>
											<li class="message-li <#if list.readunread == '未读'>opacity</#if>" id="${list.id!''}">
												<span class="message-type">帖子</span>
												<a href="#" onclick="gotoLink('/topic/detail/${list.fileid!''}.html?msgid=${list.id!''}','${list.fileid!''}','${list.id}','${list.msgtype!''}')" class="message-title layui-elip">${list.title!''}</a>
												<span class="message-dynamic">贴子评论被采纳了</span>
												<a href="#" onclick="deleteLink('${list.id!''}');" class="message-delete">不再提示</a>
											</li>
										<#elseif list.msgtype==6>
											<li class="message-li <#if list.readunread == '未读'>opacity</#if>" id="${list.id!''}">
												<span class="message-type">帖子</span>
												<a href="#" onclick="gotoLink('/topic/detail/${list.fileid!''}.html?msgid=${list.id!''}','${list.fileid!''}','${list.id}','${list.msgtype!''}')" class="message-title layui-elip">${list.title!''}</a>
												<span class="message-dynamic">您关注的人发布了新的帖子</span>
												<a href="#" onclick="deleteLink('${list.id!''}');" class="message-delete">不再提示</a>
											</li>
										<#elseif list.msgtype==2>
											<li class="message-li <#if list.readunread == '未读'>opacity</#if>" id="${list.id!''}">
												<span class="message-type">案例</span>
												<#if list.messagecontent?trim=='审核未通过'>
													<a href="/microcase/uploadcaseindex.html?msgid=${list.id!''}" class="message-title layui-elip">${list.title!''}</a>
												<#else>
													<a href="#" onclick="gotoLink('/admin/microcase/hotDetail/${list.fileid!''}.html?id=${list.fileid!''}&msgid=${list.id!''}','${list.fileid!''}','${list.id}','${list.msgtype!''}')" class="message-title layui-elip">${list.title!''}</a>
												</#if>
												<span class="message-dynamic">案例${list.messagecontent!''}</span>
												<a href="#" onclick="deleteLink('${list.id!''}');" class="message-delete">不再提示</a>
											</li>
										<#elseif list.msgtype==3>
											<li class="message-li <#if list.readunread == '未读'>opacity</#if>" id="${list.id!''}">
												<span class="message-type">案例</span>
												<a href="#" onclick="gotoLink('/admin/microcase/hotDetail/${list.fileid!''}.html?id=${list.fileid!''}&msgid=${list.id!''}','${list.fileid!''}','${list.id}','${list.msgtype!''}')" class="message-title layui-elip">${list.title!''}</a>
												<span class="message-dynamic">评论有了新的回复</span>
												<a href="#" onclick="deleteLink('${list.id!''}');" class="message-delete">不再提示</a>
											</li>
										<#elseif list.msgtype==7>
											<li class="message-li <#if list.readunread == '未读'>opacity</#if>" id="${list.id!''}">
												<span class="message-type">案例</span>
												<a href="#" onclick="gotoLink('/admin/microcase/hotDetail/${list.fileid!''}.html?id=${list.fileid!''}&msgid=${list.id!''}','${list.fileid!''}','${list.id}','${list.msgtype!''}')" class="message-title layui-elip">${list.title!''}</a>
												<span class="message-dynamic">您关注的人发布了新的案例</span>
												<a href="#" onclick="deleteLink('${list.id!''}');" class="message-delete">不再提示</a>
											</li>
										<#elseif list.msgtype==4>
											<li class="message-li <#if list.readunread == '未读'>opacity</#if>" id="${list.id!''}">
												<span class="message-type">留言</span>
												<span class="message-title phone-title">
													<a href="#" onclick="gotoLink('/user/otherUser/${list.messagecontent!''}.html?msgid=${list.id!''}','${list.fileid!''}','${list.id}','${list.msgtype!''}')" target="_blank" class="message-username">${list.title!''} </a>
													<span>给你留言了</span>
													<a href="#" onclick="gotoLink('/messageboard/index/${list.userid!''}.html?msgid=${list.id!''}','${list.fileid!''}','${list.id}','${list.msgtype!''}')" class="view-now">立即查看</a>
												</span>
												<span class="message-dynamic phone-dynamic"></span>
												<a href="javascript:;" onclick="deleteLink('${list.id!''}');" class="message-delete">不再提示</a>
											</li>
										<#elseif list.msgtype==5>
											<li class="message-li <#if list.readunread == '未读'>opacity</#if>" id="${list.id!''}">
												<span class="message-type">关注</span>
												<span class="message-title phone-title"><a class="message-username" href="#" onclick="gotoLink('/user/otherUser/${list.messagecontent!''}.html?msgid=${list.id!''}','${list.fileid!''}','${list.id}','${list.msgtype!''}')" target="_blank">${list.title!''} </a>关注你啦！</span>
												<span class="message-dynamic phone-dynamic"></span>
												<a href="javascript:;" onclick="deleteLink('${list.id!''}');" class="message-delete">不再提示</a>
											</li>
										</#if>
									</#list>
								</#if>
							</ul>
						</div>
					</div>
				</div>
			</div>
			<div style="text-align: center" class="front-desk">
				<div class="laypage-main" id="pages"></div>
			</div>
		</div>
	</div>
</div>
<script>
var list = []; 
<#list messageList.content as list >
	list.push({
		"id": "${list.id!''}",
		"msgtype": "${list.msgtype!''}",
		"userid": "${list.userid!''}",
		"readunread": "${list.readunread!''}",
		"creater": "${list.creater!''}",
		"messagecontent": "${list.messagecontent!''}",
		"title": "${list.title!''}",
		"total": "${list.total!''}"
	}); 
</#list>
console.log(list);

layui.use(['laypage', 'layer'], function() {
	var laypage = layui.laypage;
	laypage({
		cont: 'pages',
		first: '首页',
		last: '末页',
		pages: ${messageList.totalPages},
		curr: ${messageList.number + 1},
		skin: '#32c24d',
		skip: true,
		jump: function(obj, first) {
			var curr = obj.curr;
			if(!first) {
				location.href = '/messagebox/index?p=' + curr + "<#if RequestParameters['q']?? && RequestParameters['q'] != ''>&q=${RequestParameters['q']}</#if>";
			}
		}
	});
});

function deleteLink(id) {
	$.ajax({
		type: "POST",
		url: "/messagebox/deleteByid.html",
		dataType: "text",
		data: {
			id: id
		},
		async: false,
		beforeSend: function() {

		},
		success: function(data) {
			$("#" + id).remove();
		}

	});
}
function gotoLink(url,fileid,msgid,type) {//跳转前判断信息时候被删除
	$.ajax({
		type: "POST",
		url: "/messagebox/querybyfileid.html",
		async: false,
		data:{fileid:fileid,msgid:msgid,type:type},
		success: function(data) {
			if(data == "success"){
				window.location.href=url;
			}else{
				layer.open({
					  icon: 5, 
					  title:'提示',
					  skin: 'layui-layer-demo', //样式类名
					  closeBtn: 1, //不显示关闭按钮
					  shadeClose: true, //开启遮罩关闭
					  content: '对不起,信息已不存在！',
					  btn: ['确定'],
					  yes: function(){
				                 layer.closeAll();
				          }
				});
			}
		}

	});
}
</script>

